package study.javaee.practice.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import study.javaee.practice.common.BO.ResultBO;
import study.javaee.practice.entity.vo.ProjectJoinApplyVO;
import study.javaee.practice.service.impl.ProjectJoinApplyServiceImpl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("ProjectJoinApply")
public class ProjectJoinApplyController {
    @Autowired
    private ProjectJoinApplyServiceImpl projectJoinApplyService;
    @GetMapping("/findAllProjectJoinApplyVO")
    @PreAuthorize("!isAnonymous()")
    public List<ProjectJoinApplyVO> findAllProjectJoinApplyVO(ProjectJoinApplyVO data, HttpServletRequest request){
        return projectJoinApplyService.findAllProjectJoinApplyVO(data);
    }

    @PostMapping("/updateProjectJoinApplyState")
    public ResultBO updateProjectJoinApplyState(ProjectJoinApplyVO data){
        Boolean b=projectJoinApplyService.updateProjectJoinApplyState(data);
        if(null!=b)
        {
            return new ResultBO(20000);
        }
        else {
            return new ResultBO(400);
        }
    }

}
